<?php
namespace app\post;

use app\module\BaseModule;
use yii\base\BootstrapInterface;
use app\base\classes\Hook;
use app\system\enums\ModuleGroupEnmu;


class Module extends BaseModule implements BootstrapInterface
{

    public function init()
    {
        parent::init();
    }

    public function bootstrap($app)
    {
        Hook::on(new \app\post\hooks\EntityUrlPrefix());
        Hook::on(\app\system\Module::EVENT_SYSTEM_GROUPNAV, [
            $this,
            "onSetGroupNav"
        ]);
    }

    /**
     *
     * @param \app\base\helpers\Event $event
     */
    public function onSetGroupNav($event)
    {
        $item = [
            'label' => "文章管理",
            'icon' => "fa-file-text-o",
            'url' => [
                "/$this->id/default/index"
            ],
        ];
        
        $event->parameters->set(ModuleGroupEnmu::CONTENT, [
            $item
        ]);
    }

    public static function getUserList()
    {
        $userClass = \Yii::$app->getUser()->identityClass;
        return $userClass::getUsersList();
    }
}

?>